﻿using Core.SimpleTemp.Application;
using Core.SimpleTemp.Mvc.Api.Internal;
using Core.Toolkit.Core.Api;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Core.SimpleTemp.Api.Api.YH
{
    /// <summary>
    /// 
    /// </summary>
    [ApiExplorerSettings(GroupName = "Sys")]//swagger分类标签
    [Route("api/[controller]")]//路由说明
    [EnableCors("any")]//跨域规则
    [ApiController]//APi标识Controller
    [Authorize]//验证是否登录
    public class YHController : CoreApiController
    {
        private YH_BasisTypeService _BasisTypeService;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="BasisTypeService"></param>
        public YHController(YH_BasisTypeService BasisTypeService)
        {
            _BasisTypeService = BasisTypeService;
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="factoryId"></param>
        /// <returns></returns>
        [HttpGet("BasisType/{factoryId?}")]
        public async Task<IActionResult> BasisType(Guid? factoryId)
        {
            var result = await _BasisTypeService.GetList(factoryId);
            return this.JsonSuccess(result);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetListSub")]
        public async Task<IActionResult> GetListSub() 
        {
            var factoryId = UserIdentity.Factory;
            var result = await _BasisTypeService.GetList(factoryId);
            return this.JsonSuccess(result);
        }
        

    }
}
